#include <Report.h>

#include <QString>

void Report::SetAuthor(const std::string& someAuthor)
{
    author = someAuthor;
}

void Report::SetTaxPayerId(unsigned long someTaxPayerId)
{
    taxPayerId = someTaxPayerId;
}

void Report::SetDocumentDetails(const DocumentDetails& someDocumentDetails)
{
    documentDetails = someDocumentDetails;
}

void Report::SetReportPeriod(short int someReportPeriod)
{
    reportPeriod = someReportPeriod;
}

void Report::SetReportMonth(short int someReportMonth)
{
    reportMonth = someReportMonth;
}

void Report::SetReportYear(short int someReportYear)
{
    reportYear = someReportYear;
}

void Report::SetAdminRegion(short int someAdminRegion)
{
    adminRegion = someAdminRegion;
}

void Report::SetAdminDistrict(short int someAdminDistrict)
{
    adminDistrict = someAdminDistrict;
}

void Report::SetCreationDate(const Date& someCreationDate)
{
    creationDate = someCreationDate;
}

std::string Report::GenerateFileName()
{
    std::string result;

   // result = QString::sprintf("%02hd%02hd%010hd%s%s%02hd%hd%02hd%05hd%02hd%04hd", adminRegion, adminDistrict, taxPayerId, documentDetails.code, documentDetails.subType, documentDetails.version, documentDetails.state, documentDetails.type, documentDetails.number, reportMonth, reportYear).toStdString();

    //QString result2 = QString("%02d%02d%010d%s%s%02d%d%02d%05d%02d%04d").arg(adminRegion).arg(adminDistrict).arg(taxPayerId);

    QString result2 = QString("%1%2%3%4%5%6%7%8%9%10%11").arg(adminRegion, 2, 10, QChar('0')).
                      arg(adminDistrict, 2, 10, QChar('0')).
                      arg((ulong)taxPayerId, 10, 10, QChar('0')).
                      arg(documentDetails.code.c_str(), documentDetails.subType.c_str()).
                      arg(documentDetails.version, 2, 10, QChar('0')).
                      arg(documentDetails.state).
                      arg(documentDetails.type, 2, 10, QChar('0')).
                      arg(documentDetails.number, 5, 10, QChar('0')).
                      arg(reportMonth, 2, 10, QChar('0')).
                      arg(reportYear, 4, 10, QChar('0'));

    return (result2 + ".xml").toStdString();

}

